package com.ycode.bang.anbang.network;

import net.tsz.afinal.FinalHttp;
import net.tsz.afinal.http.AjaxCallBack;
import net.tsz.afinal.http.AjaxParams;

/**
 * @author:jeney
 * @date:2015/5/20
 * @todo:
 */
public class FinalHttpUtil {
    public static FinalHttp finalHttp = new FinalHttp();

    static {
//        finalHttp.configTimeout(20 * 1000);
        finalHttp.configTimeout(10 * 1000);
        finalHttp.configRequestExecutionRetryCount(1);
    }

    public static void post(String url, AjaxParams ajaxParams, AjaxCallBack<? extends Object> ajaxCallBack) {
//        finalHttp.addHeader("Cookie", "JSESSIONID="+FinalHttpService.getUser_cookie() );//把sessionid做成一个静态变量
        finalHttp.post(url, ajaxParams, ajaxCallBack);
    }

    public static void get(String url, AjaxParams ajaxParams, AjaxCallBack<? extends Object> ajaxCallBack) {
//        finalHttp.addHeader("Cookie", "JSESSIONID="+FinalHttpService.getUser_cookie() );//把sessionid做成一个静态变量
        finalHttp.get(url, ajaxParams, ajaxCallBack);
    }
}
